package structural.proxy.common;

/**
 * @author wangjinqiang
 * @date 2019-08-05
 */
public class Proxy implements Subject {
    /**
     * 要代理的对象
     */
    private Subject subject;

    /**
     * 默认被代理者
     */
    public Proxy() {
        this.subject = new Proxy();
    }

    public Proxy(Subject subject) {
        this.subject = subject;
    }

    @Override
    public void request() {
        this.before();
        this.subject.request();
        this.after();
    }

    /**
     * 预处理
     */
    private void before() {

    }

    /**
     * 善后处理
     */
    private void after() {

    }
}

